
package cn.edu.nju.software.greencreditsystem.domain;

import java.util.List;
import javax.persistence.*;

/**
 * 作者：何启睿
 * 创建时间：2011-8-1
 * 类描述：企业实体类
 */
@Entity
@Table(name="enterprise")
public class Enterprise 
{
    private int id;
    private String name;
    private String address;
    private String email;
    private int level;
    private byte avatar[];
    private List<FinancialExcel> financialExcel;
    private List<EnvironmentExcel> environmentExcel;
    private String username;
    private String password;
    private EnterpriseType enterpriseType;

    
    @Id
    @GeneratedValue
    @Column(name="enterprise_id")
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName(){
        return name;
    }
    
    public void setName(String name) {
        this.name = name;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String eMail) {
        this.email = eMail;
    }

    @Column(unique=true)
    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }
    
    @ManyToOne
    public EnterpriseType getEnterpriseType() {
        return enterpriseType;
    }

    public void setEnterpriseType(EnterpriseType enterpriseType) {
        this.enterpriseType = enterpriseType;
    }

    @Column(name="_level")
    public int getLevel()
    {
        return level;
    }

    public void setLevel(int level)
    {
        this.level = level;
    }

    @Lob
    public byte[] getAvatar()
    {
        return avatar;
    }

    public void setAvatar(byte avatar[])
    {
        this.avatar = avatar;
    }

    @OneToMany(cascade={CascadeType.ALL})
    @JoinColumn(name="enterprise_id")
    public List<FinancialExcel> getFinancialExcel()
    {
        return financialExcel;
    }

    public void setFinancialExcel(List<FinancialExcel> financialExcel)
    {
        this.financialExcel = financialExcel;
    }

    @OneToMany(cascade={CascadeType.ALL})
    @JoinColumn(name="enterprise_id")
    public List<EnvironmentExcel> getEnvironmentExcel()
    {
        return environmentExcel;
    }

    public void setEnvironmentExcel(List<EnvironmentExcel> environmentExcel)
    {
        this.environmentExcel = environmentExcel;
    }
}
